#!/usr/bin/env bash
#
# SAMPLE DRIVER SCRIPT
#

EXE_NAME=$1
TMP_FILE=stdout.tmp

# start timing
t_start=$(date +%s.%3N)

# MODIFY THIS: run binary
./${EXE_NAME} >"${TMP_FILE}"
exit_code=$?

# stop timing
t_stop=$(date +%s.%3N)

# calculate runtime
runtime=$(echo "$t_stop - $t_start" | bc)

# MODIFY THIS: check verification
status="pass"
if [ $exit_code -ne 0 ]; then
    status="error"
else
    check=$(grep "[^N]SUCCESSFUL" $tmp_file)
    if [ -z "$check" ]; then
        status="fail"
    fi
fi

# MODIFY THIS: calculate error
error="0.0e0"

# print output
echo "status:  $status"
echo "time:    $runtime"
echo "error:   $error"

# cleanup
rm -f $tmp_file


